<template>
  <div id="app">
    <router-view />
    <theme-picker />
  </div>
</template>

<script>
import ThemePicker from "@/components/ThemePicker";

export default {
  name: "App",
  components: { ThemePicker },
    watch: {
    $route(val) {
      process.env.NODE_ENV === 'development' && this.$nextTick(() => {
        const cssBox = bg => `
          color: #fff;
          background-color: ${bg};
          padding: 2px 4px;
          border-radius: 4px;
          margin: 2px 10px;
        `
        console.log(
          `%c${
            val.meta.title
          }%c\n%c${
            val.fullPath
          }%c\n%c${
            val.matched.at(-1).instances.default?.$options.__file
          }`,
          cssBox('#409eff'),
          '',
          cssBox('#67c23a'),
          '',
          cssBox('#909399'),
        )
      })
    }
  },
  metaInfo() {
    return {
      title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
      titleTemplate: title => {
        return title ? `${title} - ${process.env.VUE_APP_TITLE}` : process.env.VUE_APP_TITLE
      }
    }
  }
};
</script>
<style scoped>
#app .theme-picker {
  display: none;
}
</style>
